package top.zuli.package03.exam01;

public class StaticProxyDemo2 {
    public static void main(String[] args) {
        User2 user2 = new UserImpl2();
        user2.add("祖力");
        user2.del("1");
        User2 proxyUser = new UserProxy2(user2);
        proxyUser.add("李四");
        proxyUser.del("2");
    }
}
interface User2{
    public void add(String data);
    public void del(String id);
}
class UserImpl2 implements User2{

    @Override
    public void add(String data) {
        System.out.println("添加"+data+"据");
    }

    @Override
    public void del(String id) {
        System.out.println("根据"+id+"删除数据");
    }
}
class UserProxy2 implements User2{
    private User2 user2;

    public UserProxy2(User2 user2){
        this.user2 = user2;
    }

    @Override
    public void add(String data) {
        user2.add(data);
        System.out.println("日志信息");
    }

    @Override
    public void del(String id) {
        user2.del(id);
        System.out.println("日志信息");
    }
}